package a11;

import java.awt.*;
//import java.awt.BorderLayout;
//import java.awt.Dimension;
//import java.awt.Image;
import java.io.File;
//import javax.swing.ImageIcon;
//import javax.swing.JFrame;
//import javax.swing.JLabel;
//import javax.swing.JMenu;
//import javax.swing.JMenuBar;
//import javax.swing.JMenuItem;
//import javax.swing.JPanel;
//import javax.swing.JTextArea;
//import javax.swing.JTextField;
import javax.swing.*;

/**
 * @author ANDyT
 *
 */
public class FileOSGUI extends JFrame {

	private static final long serialVersionUID = 4445700994336805381L;
	private FileOSActionListeners ali;
	private JTextField _fileNameTF;
	
	
	public FileOSGUI() {
		this.ali = new FileOSActionListeners(this);
		
		// Textfeld initialisieren
		_fileNameTF = new JTextField();
		_fileNameTF.setEditable(false);
		_fileNameTF.setPreferredSize(new Dimension(320,20));

		// Content-Pane, Layout-Komponenten
		JPanel content = new JPanel();
		JPanel statusBar = new JPanel();
//		JPanel fextension = new JPanel();
//		JTextArea logger = new JTextArea("Programm gestartet");
//		logger.setEditable(false);
//		ImageIcon preview = new ImageIcon("e:/RSKULL.jpg");
		content.setLayout(new BorderLayout());
//		fextension.setLayout(new BorderLayout());
		statusBar.setLayout(new BorderLayout());
//		content.add(logger,BorderLayout.WEST);
//		content.add(fextension,BorderLayout.EAST);
		content.add(statusBar,BorderLayout.SOUTH);
//		fextension.add(new JLabel(new ImageIcon(preview.getImage().getScaledInstance(90, -1, Image.SCALE_DEFAULT))),BorderLayout.EAST);
		statusBar.add(new JLabel("File:"));
		statusBar.add(_fileNameTF,BorderLayout.SOUTH);

		// Menueelemente (menubar, menu, menu item)
		JMenuBar menubar = new JMenuBar();
		JMenu fileMenu = new JMenu("File");
		JMenuItem infoItem = new JMenuItem("Info");
		JMenuItem openItem = new JMenuItem("Open...");
		JMenuItem saveItem = new JMenuItem("Save...");
		JMenuItem closeItem = new JMenuItem("Close!");
		openItem.addActionListener(ali);
		saveItem.addActionListener(ali);
		closeItem.addActionListener(ali);
		infoItem.addActionListener(ali);

		// Menue zusammenstellen
		menubar.add(fileMenu);
		menubar.add(infoItem);
		fileMenu.add(openItem);
		fileMenu.add(saveItem);
		fileMenu.addSeparator();
		fileMenu.add(closeItem);

		// Fensterkonfiguration
		this.setJMenuBar(menubar);
		this.setContentPane(content);
		this.setTitle("FileOC");
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setPreferredSize(new Dimension(320, 240));
		this.setResizable(false);
		this.pack(); // Layout components..
		this.setLocationRelativeTo(null); // zentrieren.
	}
	
	public void setFileNameTF(File path) {
		this._fileNameTF.setText(path.toString());
	}
	
}
